package com.inspur.demo.controller;

import com.inspur.demo.common.CommResultMsg;
import com.inspur.feign.FeignTestClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 控制层
 *
 * @desc:
 * @author: li.peng02
 * @date: 2019/3/15
 * @version: v1.0 
 */
@RestController
@RequestMapping
public class FeignController {

    @Autowired
    private FeignTestClient feignTestClient;

    @GetMapping("/feignClient/get/{id}")
    public String get(@PathVariable String id) {
        String result = feignTestClient.get(id);
        return result;
    }

    @GetMapping("/feignClient/getResult01/{id}")
    public CommResultMsg getUser(@PathVariable String id) {
        CommResultMsg result = feignTestClient.getResult01(id);
        return result;
    }

    @GetMapping("/feignClient/getResult02")
    public CommResultMsg getUser2(CommResultMsg comm) {
        CommResultMsg result = feignTestClient.getResult02(comm);
        return result;
    }

    @GetMapping("/feignClient/list")
    public List<CommResultMsg> list() {
        return feignTestClient.list();
    }

    @PostMapping("/feignClient/postResult01")
    public CommResultMsg postUser(@RequestBody CommResultMsg comm) {
        CommResultMsg result = feignTestClient.postResult01(comm);
        return result;
    }

    @PostMapping("/feignClient/postResult02")
    public CommResultMsg postUser2(@RequestBody CommResultMsg comm) {
        CommResultMsg result = feignTestClient.postResult02(comm);
        return result;
    }
}
